<template>
	<view>
		<!-- 订单编号 -->
		<view class="cover-bg order-number">
				<text style="color: #999999;margin-left: 15rpx;">订单编号</text>
				<view style="display: flex;flex-direction: row;">
					<text>{{orderNumber}}</text>
					<view style="margin:0 15rpx;color: #3776E5;" @click="copyMsg(orderNumber)" >复制</view>
				</view>
		</view>
		<!-- 收转人 -->
		<view class="cover-bg order-number transferee">
			<text style="color: #999999;margin-left: 15rpx;">收转人:<text>{{transferee}}</text></text>
			<view style="margin-right: 15rpx;" @click="goTransferee">请选择 ></view>
		</view>
		<!-- 转单说明 -->
		<textarea class="cover-bg order-describe" @blur="textValue" value="" placeholder="请输入转单说明..." />
		<!-- footer -->
		<view class="footer">
			<button type="primary" @click="meaksure">确定</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			
				id:'',
				orderNumber:'123',
				//说明
				seachValue:'',
				//转单说明
				orderDescribe:'',
				//转单人
				transferee:'',
				//传给serverList的数组
				transFromList:[]
			}
		},
		onShow(option) {
			
			//2.拿到serverList页面传入的值
			uni.getStorage({
				key:'orderNumber',
				success:(res)=> {
					this.orderNumber=res.data
					// console.log(this.orderNumber)
				}
			})
			//3.拿到transferee页面传入的值
			uni.getStorage({
				key:'allNameList',
				success:(res)=> {
					this.transferee=res.data
				}
			})
		},
		
		methods: {
			// 跳转收转人页面
			goTransferee(){
				uni.navigateTo({
					url:'../transfereeList/transfereeList'
				})
			},
			// 确定
			meaksure(){
				uni.setStorage({
					key:'transFromList',
					data:[this.orderNumber,this.transferee,this.orderDescribe],
					success:()=> {
						uni.navigateTo({
							url:'../serviceList/serviceList'
						})
					}
				})
			},
			textValue(e){
				this.orderDescribe=e.detail.value
				// console.log(this.orderDescribe)
			},
			//复制
			copyMsg(value){
				//uni.setClipboardData方法就是讲内容复制到粘贴板
				// API `setClipboardData` is not yet implemented
				//意思是H5端没有这个接口！！！
				uni.setClipboardData({
					data: value, //要被复制的内容
					success: function() {
							//在success中加入uni.hideToast()可以解决
							uni.showToast({
								title: '复制成功',
								duration: 2000,
							});
							
						},
						fail: function(err) {
							uni.showToast({
								title: '复制失败',
								duration: 2000,
							});
						}
				});

			}
		}
	}
</script>

<style scoped>
.cover-bg{
		width: 94vw;
		margin: 20rpx 20rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		box-shadow: 0 1rpx 3rpx 0 #CDCDCD;
		border:2rpx solid #CDCDCD;
	}
.order-number{
	height: 80rpx;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	
}
/* 转单说明 */
.order-describe{
	width: 88vw;
	height: 480rpx;
	padding: 20rpx;
}
/* footer */
.footer{
	margin: 15rpx;
}
</style>
